namespace DuToanT2.Models.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.UserProfile",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        UserName = c.String(nullable: false, maxLength: 50),
                        RealName = c.String(maxLength: 50),
                        PhoneNumber = c.String(),
                        Email = c.String(),
                        IsWorking = c.Boolean(nullable: false),
                        Description = c.String(),
                        LastLogin = c.DateTime(),
                    })
                .PrimaryKey(t => t.ID);
            
            CreateTable(
                "dbo.Project",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name = c.String(nullable: false, maxLength: 150),
                        Description = c.String(maxLength: 150),
                        UserId = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.UserProfile", t => t.UserId, cascadeDelete: true)
                .Index(t => t.UserId);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Project", new[] { "UserId" });
            DropForeignKey("dbo.Project", "UserId", "dbo.UserProfile");
            DropTable("dbo.Project");
            DropTable("dbo.UserProfile");
        }
    }
}
